﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Colors;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

/**
 * 多行文字 
 */
namespace Dmo_lc_2.Shape
{
    public class MTextShape : BaseShape
    {
       public string textString;
       public double[] position;
       public double textHeight; // 文本高度
       public double height; // 文本框高度
       public double width;  // 文本框宽度
       public double descent;
       public double ascent;
        public double lineHeight;

        public double rotation;

        public MTextShape(Entity in_entity, Transaction tr) : base(in_entity, tr)
        {
        }

        public override void Init()
        {
            shapeType = ShapeType.MTEXT;
            shapeTypeName = shapeType.ToString();

            MText in_shape = (MText)mEntity;
            color = getColor();
            textString = in_shape.Text; // 文本内容

            position = new double[] { in_shape.Location.X, in_shape.Location.Y, in_shape.Location.Z };
            textHeight = in_shape.TextHeight; //设置文本高度 
            height = in_shape.Height; // 文本框宽度
            width = in_shape.Width; // 文本框高度

//            var columnWidth = in_shape.ColumnWidth;
            rotation = in_shape.Rotation;
            descent = in_shape.Descent;
            ascent = in_shape.Ascent;
            lineHeight = in_shape.LineSpaceDistance;
        }
    }
}